主题
读取图片字节流 - GetImageData
函数简介
获取指定图像的二进制数据,数据格式BBGGRRAA(BGRA),每个像素4字节。
接口名称
GetImageDataDLL调用
int GetImageData(long ola, long ptr, long* data, int* size, int* stride);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| ptr | 长整数型 | OLAImage对象的地址 |
| data | 长整数型指针 | 返回图片的数据指针 |
| size | 整数型指针 | 返回图片的数据长度 |
| stride | 整数型指针 | 返回图片的步长数据(每行数据字节数) |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.GetImageData(0, "value", "value", "value");csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.GetImageData(0, "value", "value", "value");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.GetImageData(0, "value", "value", "value")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.GetImageData(0, "value", "value", "value");cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.GetImageData(0, "value", "value", "value")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.GetImageData(0, "value", "value", "value")text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.GetImageData(0, “value”, “value”, “value”)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.GetImageData(0, "value", "value", "value");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.GetImageData(0, "value", "value", "value")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.GetImageData(0, "value", "value", "value");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
GetImageData(instance, 0, 0, 0, 0);csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetImageData(long ola, long ptr, long data, int size, int stride);
long instance = CreateCOLAPlugInterFace();
GetImageData(instance, 0, 0, 0, 0);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.GetImageData(instance, 0, 0, 0, 0)返回值
整数型:1 成功,0 失败。
注意事项
- 图像指针释放后(FreeImagePtr),data地址的数据就会被释放,需要把数据拷贝到自己的字节集中再使用。
- 图像宽度 = stride / 4,图像高度 = size / stride。
